<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="created" content="2018-10-23T06:18:10.521000000">
    <meta name="changed" content="2018-10-23T06:18:42.262000000">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Language" content="en">
    <title>
      JAR Libraries
    </title>
    <link rel="stylesheet" type="text/css" href="../../style.css">
  </head>
  <body>
    <div class="maindiv">
      <h1>
        JAR Libraries
      </h1>
      <h2>
        Using JAR libraries
      </h2>
      <p>
        Logisim has two types of circuit components: those that are designed within Logisim as combinations of components, and those primitive components that are written in Java. Logisim circuits are easier to design, but they cannot support sophisticated user interaction, and they are relatively inefficient.
      </p>
      <p>
        Logisim contains a fairly thorough collection of built-in libraries of Java components, but it can also load additional libraries written by you or others. Once you have downloaded a library, you can import it into your project by right-clicking the project in the explorer pane (the top line) and choosing Load Library &gt; JAR Library.... Then, Logisim will prompt you to select the JAR file. (In some circumstances, you may have to type the starting class name when prompted, which would be provided by the library developer. However, a developer typically configures the JAR library to avoid this (by including a <q>manifest</q> file in the JAR with a Library-Class attribute specifying the main class name).)
      </p>
      <h2>
        Creating JAR libraries
      </h2>
      <p>
        The remainder of this section is dedicated to a series of thoroughly commented examples illustrating how to develop Logisim libraries yourself. You should only attempt this if you're an experienced Java programmer. You will find the documentation beyond these examples fairly meager.
      </p>
      <p>
        You can download a JAR file that allows these examples to be imported into Logisim via the Logisim Web site's Links section. That JAR file also contains the source code contained in these examples.
      </p>
      <dl>
        <dt>
          <a href="incr.html">Gray Code Incrementer</a>
        </dt>
        <dd>
          <p>
            Illustrates the essential components of any component type using a simple example of a component that takes a multibit input and computes the next Gray code value following it.
          </p>
        </dd>
        <dt>
          <a href="library.html">Library Class</a>
        </dt>
        <dd>
          <p>
            Illustrates how to define a library. This is the entry point for any JAR file - the class whose name the user enters when loading the JAR library.
          </p>
        </dd>
        <dt>
          <a href="simpctr.html">Simple Gray Code Counter</a>
        </dt>
        <dd>
          <p>
            Illustrates how to make a component that has internal state, in particular an 8-bit counter that iterates through Gray codes.
          </p>
        </dd>
        <dt>
          <a href="counter.html">Gray Code Counter</a>
        </dt>
        <dd>
          <p>
            Demonstrates a complete, fairly sophisticated component with which the user can interact. It implements a Gray code counter where the number of bits remembered is customizable, and where the user can edit the current value by clicking on it with the Poke Tool and typing a value.
          </p>
        </dd>
        <dt>
          <a href="guide.html">Guidelines</a>
        </dt>
        <dd>
          General information for those developing third-party libraries.
        </dd>
      </dl>
      <h2>
        License
      </h2>
      <p>
        The code in this example JAR library is released under the MIT license, a more permissive license than the GPL, under which the rest of Logisim is released.
      </p>
      <p>
        Copyright (c) 2009, Carl Burch.
      </p>
      <p>
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
      </p>
      <p>
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
      </p>
      <p>
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
      </p>
      <p>
        <b>Next:</b> <a href="incr.html">Gray Code Incrementer</a>.
      </p>
    </div>
  </body>
</html>
